package com.example.lianxi222.adapter;

import android.media.Image;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.lianxi222.R;
import com.example.mvvm_base.userbean.VideoEntity;

import java.util.List;

public class RecyclerAdapter extends BaseQuickAdapter<VideoEntity.DataBean, BaseViewHolder> {

    public RecyclerAdapter(int layoutResId, @Nullable List<VideoEntity.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, VideoEntity.DataBean dataBean) {
        baseViewHolder.setText(R.id.first_text,dataBean.getCaption());
        ImageView iv=baseViewHolder.getView(R.id.first_image);
        ImageView like=baseViewHolder.getView(R.id.first_like);
        Glide.with(getContext()).load(dataBean.getHeadpath()).into(iv);
        if(dataBean.getDianzan()==0){
             baseViewHolder.setImageResource(R.id.first_like,R.drawable.ic_action_like);
        }else{
            baseViewHolder.setImageResource(R.id.first_like,R.drawable.ic_action_like2);
        }
    }
}
